package cn.explink.dop.enums.pub;

import java.util.ArrayList;
import java.util.List;

/**
 * 是否启用
 *
 * @author firefly 2015-2-28 10:40
 *
 */
public enum EnableEnum {

	Enable(1, "启用"), Unable(2, "停用");

	private int value;
	private String text;

	private EnableEnum(int value, String text) {
		this.value = value;
		this.text = text;
	}

	public int getValue() {
		return this.value;
	}

	public String getText() {
		return this.text;
	}

	public static List<EnableEnum> getAllStatus() {
		List<EnableEnum> enableEnumList = new ArrayList<EnableEnum>();
		enableEnumList.add(Enable);
		enableEnumList.add(Unable);
		return enableEnumList;
	}

	public static String getTextByValue(int value) {
		List<EnableEnum> allStatus = EnableEnum.getAllStatus();
		for (EnableEnum enableEnum : allStatus) {
			if (enableEnum.getValue() == value) {
				return enableEnum.getText();
			}
		}
		return "";
	}
}
